$(function (){
    $("#loginBtn").click(function (e){
        e.preventDefault();
        var data = {
            email: $("#email").val(),
            password: $("#password").val()
        }

        $.ajax({
            url: '/auth/login',
            type: 'POST',
            contentType: 'application/json',
            data: JSON.stringify(data),
            success: function (res){
                if(res.code === 200){
                    window.location.href = '/';
                    console.log(res);
                }else{
                    showWarning(res.message);
                }
            },
            error: function (xhr, status, error) {
            console.error("请求失败:", error);
        }
        })
    })
})